from dataclasses import dataclass,field

@dataclass
class asm_node:

    func_id: int=0
    func_addr: str=""
    func_name: str=""
    idx_in_func: int=0
    asm_addr: str=""
    mnemonic: str=""
    op_str: str=""
    ctb_0: float=0 # contribution to be judged as 0
    ctb_1: float=0

    def to_dict(self):
        return self.__dict__
    
    def to_json(self):
        return {
            "func_id": self.func_id, 
            "func_addr": self.func_addr, 
            "func_name": self.func_name,
            "idx_in_func": self.idx_in_func,
            "asm_addr": self.asm_addr,
            "mnemonic": self.mnemonic,
            "op_str": self.op_str,
            "ctb_0": self.ctb_0, # contribution to be judged as 0
            "ctb_1": self.ctb_1
        }